package com.eling.elcms.community.dao.hibernate;

import com.eling.elcms.community.dao.IOrgCustomizationDao;
import com.eling.elcms.community.model.OrgCustomization;
import com.eling.elcms.core.dao.hibernate.GenericDaoHibernate;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;

@Repository
public class OrgCustomizationDaoHibernate extends GenericDaoHibernate<OrgCustomization, Long> implements IOrgCustomizationDao {

    public OrgCustomizationDaoHibernate() {
        super(OrgCustomization.class);
    }

	@Override
	public Integer getCsidByPkOrg(Long pkOrg) {
		String sql =  "select smsSignNum from cm_orgcustomization where pkOrganization =:pkOrg";
		String str =(String)getSession().createNativeQuery(sql).setParameter("pkOrg", pkOrg).uniqueResult();
		if(StringUtils.isNotBlank(str)){
			return Integer.valueOf(str);
		}else{
			return 0;
		}
	}
}
